const Crawler = require("crawler");
let fs = require("fs");
// let jsdome = require("jsdom");
const c = new Crawler({
  maxConnections: 10,
  forceUTF8: true,
  //   jQuery: jsdome,
  callback: function(err, res, done) {
    if (err) {
      console.log(err);
    } else {
      let $ = res.$;
      //   console.log($("title"));
      console.log(res);
      fs.writeFileSync("./优酷.html", res.body, "utf-8");
      done();
    }
  }
});

// c.queue(
//   "https://v.youku.com/v_show/id_XNDE5ODg3Mzg1Ng==.html?spm=a2h0k.11417342.soresults.dtitle&s=247d76efbfbdefbfbd0e"
// );
// c.queue("http://list.youku.com/category/show/c_97_g_%E5%89%A7%E6%83%85.html");
c.queue(
  "http://api.smq1.com/?url=http://player.youku.com/embed/XNDE5ODg3Mzg1Ng"
);

/**
 *
 * 连接地址 /   "https://v.youku.com/v_show/id_XNDE5ODg3Mzg1Ng==.html?spm=a2h0k.11417342.soresults.dtitle&s=247d76efbfbdefbfbd0e"
 * 真是地址 http://player.youku.com/embed/XNDE5ODg3Mzg1Ng
 *
 *  {
 *  uri1 : http://api.smq1.com/?url=, //紫云智能视频解析 1
 *  https://jx.km58.top/jx/?url= //怀疑同意解析地址被封装;5
 *  http://17kyun.com/api.php?url= // 2
 * https://jx.hezeshi.net/ce/jlexi.php?url= 3 //怀疑所有解析地址用同一个解析api
 *
 * }
 *
 * 完整地址解析方案
 * {
 * urli : http://api.51ckm.com/Box.php?url= //box 解析
 * }
 */
